#ifndef PAIRPROD_H
#define PAIRPROD_H
#include "wcpplib/random/PointsRan.h"
#include "wcpplib/stream/prstream.h"

namespace Heed {

/// Production of electron-ion pairs by delta-electrons.
/// All energies are assumed in eV.
/// But it seems that it is not strict requirement.
/// If to change this in file "file_name" and in interface,
/// the energies could be in any units.
///
/// 2003, I. Smirnov

class PairProd {
 public:
  PairProd() = default;
  PairProd(const std::string& file_name, double fw, double ffano = 0.19);
  /// Calculate energy loss (in eV).
  double get_eloss() const;
  /// Calculate energy loss (in eV) assuming V = wa / 2.
  double get_eloss(const double ecur) const;

  void print(std::ostream& file, int l) const;

 private:
  double m_w = 30.;
  double m_f = 0.16;
  double m_wtable = 30.;
  double m_ftable = 0.16;
  double m_i = 15.;
  double m_j = 91.9243;
  /** Coefficients for conversion of the table parameters W and F
    * to the requested parameters by the formula e = e_table * k + s, 
    * where e_table is the random energy generated by the table.
    * The calculations use the features found at MC calculations:
    * If w is encreased by n times (with the same form of distribution,
    * that is equivalent to the shift of distribution,
    * the dispersion is changed as \f$1/n^2\f$ D_old.
    * If the resulting energy is multiplied by k, that is the proportional
    * extension of the distribution, the relative dispersion is not changed.
    * The relative dispersion is \f$(<N^2> - <N>^2)/N\f$.
    * If to add the onbvious change of the mean energy occurred with
    * the change of these parameters,
    * it is possible to obtain the formulae for conversion.
    */
  double m_k = 1.;
  double m_s = 0.;
  PointsRan pran;
};
}

#endif
